import React from 'react'

// 创建一个函数组件，当做UI组件。因为他们的共同点都是：简单的ui展示
export default function Order(props) {
  console.log(props);
  return (
    <div>
      <p>order组件</p>
      <button onClick={() => props.orderAction.changeList([{id: 3, name: '耳机'}])}>修改订单</button>
      <button onClick={() => props.orderAction.addList([{id: props.list.length + 1, name: '热水器'}])}>新增订单</button>
      <button onClick={() => props.orderAction.delList({index: 0})}>删除订单</button>
      {
        props.list.map(item => {
          return (<div key={item.id}>
            {item.id}. {item.name}
          </div>)
        })
      }
      <hr></hr>
    </div>
  )
}
